home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 113 / gfatip13 / gfatip13.doc < prev    next >
Text File  |  1987-11-27  |  8KB  |  182 lines

  1.  
  2.  
  3.                                               November 27, 1987
  4.  
  5.  
  6.                              GFATIP13.DOC
  7.  
  8.                            by John B. Holder
  9.                        Senior Software Engineer
  10.                         Marathon Computer Press
  11.               Asst. Sysop on GEnie's MichTron Roundtable
  12.  
  13.  
  14.           This is the (lucky) 13th issue in a planned series of 
  15.      GFA Tip files.  The topic of this issue is creating a Limited 
  16.      Multi-tasking application in GFA Basic.  In this archive you 
  17.      will find the following files:
  18.  
  19.                              GFATIP13.BAS
  20.                              GFATIP13.PRG
  21.                              GFATIP13.DOC
  22.  
  23.      
  24.                               Background
  25.  
  26.      This GFATIP is designed to show you how to coax an 
  27. application into servicing several active processes within a 
  28. running program.  It is NOT a Multi-Tasking Multi-User operating 
  29. system.  In fact the program is very simple in construction and 
  30. facility.  The whole purpose is to get you experimenting on your 
  31. own project once freshly seeded with the ideas presented here.
  32.  
  33.      I could spend hours and hours (which I don't have) discussing 
  34. the principles of construction for a Multi-Tasking environment.  
  35. Instead I will allow the application to do most of the explaining, 
  36. and I'll brush on some of the concepts and then tell you what the 
  37. different parts of the program are going to hopefully demonstrate.
  38.  
  39.                              Concepts
  40.  
  41. Fact:     Your computer spends more time at idle than at work.
  42.  
  43. Solution: Devise a way to share the CPU time among Multiple 
  44.           processes.
  45.  
  46. Fiction:  A GEM program is capable of Multi-Tasking.
  47.  
  48. Reason:   When GEM displays an AES driven Dialog Box or Alert Box 
  49.           for example, the entire processor will wait until the 
  50.           exit box has been selected. 
  51.  
  52. How To?:  Limit the use of GEM dialogs and such to a minimum if 
  53.           you are writing an application that intends to Multi-Task.
  54.  
  55.  
  56.      Not to get the author wrong here, I LOVE the GEM interface and 
  57. use it extensively.  It's just not the best answer for a user 
  58. interface that needs to Multi-Task a running application.
  59.  
  60.  
  61.                               Substance
  62.  
  63.      This GFATIP consists of a simple Looping Round Robin Scheduler 
  64. constructed totally in GFA Basic.  It's sole purpose in life is to:
  65.  
  66.      1. Display up to 4 separate processes in action, (Activity Bars 
  67. within the process windows.
  68.  
  69.      2. Allow the selective activation and deactivation of those 
  70. process displays.
  71.  
  72.      3. Display a rudimentary Process Status for each Active/Inactive 
  73. window when called for.
  74.  
  75.      4. Clear all Process Display windows on call.
  76.  
  77.      5. Present an offline <HELP!> screen for the user if they need 
  78. to get a quick dump on what keys call what features.
  79.  
  80.      6. Allow the user to press the ESCAPE key to get out of the 
  81. program and return to the Editor or GEM Desktop.
  82.  
  83.                     - - That's all there is! - -
  84.  
  85.      I said simple now didn't I?  Well, the program here is simple 
  86. and uses an integer Count% for setting up the process duration of 
  87. display instead of using a dedicated timer for each process.  The 
  88. latter could be set up with the TIMER command in GFA Basic.  This 
  89. would be more complex, however you could then assign process 
  90. priorities based on a (NICE) setting <Ala UNIX>.  In plain english 
  91. you can allow separate amounts of CPU time for the child processes.  
  92. If you were doing a game program you could allow 25% of CPU time to 
  93. sound, 25% of time to reading the keyboard, and 50% of CPU time to 
  94. drawing the game objects and such.  (Purely theoretical, the choice 
  95. is yours)
  96.  
  97.                                 Uses
  98.  
  99.      A. Games
  100.      B. Telecommunications
  101.      C. Text formatting Utilities
  102.      D. Equipment control
  103.      E. And anything else you put your mind and energy to
  104.  
  105.                     Programming Perspective     
  106.  
  107.      The truly mature and efficient application should be user 
  108. friendly & have an adaptive user interface, but should not sacrifice 
  109. the speed and capability of the Microprocessor.  Since we now have an 
  110. inexpensive computer with excellent features coupled with a fast and 
  111. easy to use Language, why not put it to the test?!  The wave of the 
  112. future is in Multi-Tasking, Multi-Programming, Multi-User systems.  
  113. Some would say "BUNK!".  Who needs that on an ST?  Well, to them I 
  114. must say "Read the writing on the Wall!".  The popularity of products 
  115. like Micro RTX by Beckemeyer, FS II, OS 9, IDRIS, and BBS 2.1 & 
  116. Juggler by MichTron are starting to answer to these demands. 
  117.  
  118.  
  119.                             The Challenge
  120.  
  121.      Why not put those neurons to work and develop a commercial 
  122. program written in GFA Basic that attempts to exploit the speed of 
  123. the language & all the while service multiple processes.  Just 
  124. remember that you saw it here first... <Grin>
  125.  
  126.  
  127.                             A Commercial?
  128.  
  129.      I am presenting this GFATIP file in advance of the release of 
  130. The GFA Basic Companion II.  There have been some facelifts to the 
  131. existing program & some really new innovative ideas added to the 
  132. Source Code Generator that create Totally new User interfacing ideas 
  133. that will allow the use of a Looping Scheduler.  They can even be 
  134. interfaced with GEM routines if so chosen.  Detached Pop-Up menus, 
  135. & Bottom up Menus can now enhance your programs.  See the MichTron RT 
  136. libraries for demonstrations of The GFA Basic Companion II.  I don't 
  137. normally advertise for my programs in a GFATIP, but this is a 
  138. significant step towards allowing for an efficient and attractive 
  139. user interface without sacrificing CPU time for user input.  I 
  140. respect your comments on this subject.
  141.  
  142.                       GENIE > Address GRIFJOHN
  143.                        CIS  > Address 75766,505
  144.  
  145.  
  146.                      Comments and PD release
  147.  
  148.      This GFATIP file is in the public Domain.  However, the 
  149. documentation file is Copyright (c)1987 by Marathon Computer Press, 
  150. and is provided as a public service.  You may not include the text of 
  151. these files in any publication, or newsletter without the approval of 
  152. Marathon Computer Press.  The source code and idea are free.  You may 
  153. also post this file on any bulletin board as long as it is posted in 
  154. it's entirety.  No charge (of any kind) may be assessed for providing 
  155. this Tip to the public.  If it's not 100% Free, don't do it!  Nuff 
  156. Said.
  157.  
  158.  
  159.  
  160.                    How to use GFATIP13.BAS / .PRG
  161.  
  162.      Either run the program from the desktop or from within the GFA 
  163. Basic Editor.  You'll see a screen with 4 non-GEM windows and a small 
  164. indicator box in each.  To get the processes running press keys 1-4 
  165. on the keyboard.  The processes can also be turned off by pressing 
  166. the keys again.  If you want to see a process status for either an 
  167. active or inactive process, press the ALTERNATE key + keys 1-4 on the 
  168. main keyboard <not the numeric keypad>.  You may do this as many 
  169. times as you desire while the processes are running.  When you want 
  170. to clear the Process windows just press the Clr Home key.  And if 
  171. this is just not enough, you may press Help to get a screen with 
  172. these features displayed.  When you are ready to Quit the Program, 
  173. hit the ESC key.  It is at this point that a GEM alert box will 
  174. appear asking you if you would like to stop or continue.  Please note 
  175. that all activity ceases, just as mentioned above in the Concept 
  176. portion of this Doc file.  Have fun with GFA Basic & This Tip File!
  177.  
  178.  
  179.                              Sincerely,
  180.                            John B. Holder
  181.  
  182.